home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / biz / misc / HomeAccountant11.lha / The Home Accountant / Acct.AMOS / Acct.amosSourceCode next >
AMOS Source Code  |  1993-09-21  |  71KB  |  2,406 lines

  1. '
  2. '
  3. '                      
  4. '                  The Home Accountant v1.0 - by Vincent Platt     
  5. '                           (c)  DragonWarez 1992-1993 
  6. '                                        
  7. '
  8. '
  9. ' ***********************  initialization begin  ************************
  10. Set Buffer 70 : Rem enough for 1000 records
  11. A#=0.0
  12. Fix(2) : Rem limits floating point #'s to two digits
  13. Global BASE$,BASEDIR$,BASEFILE$,H0MEY,PROG$,VER$
  14. Global B1,B2,B3,R1,R2,R3,H1,H2,H3,M1,M2,M3,_MOUSE
  15. Global LP,PAG,FF,SORETED,MXENTRIES,ACCTWRK$,DEF_ENTRIES,LAST_DATE$,LAST_DESCR$
  16. Proc INIT : Rem this needs to be here in order to get the correct value of mxentries 
  17. Dim DATE$(MXENTRIES),DESCR$(MXENTRIES),DEBIT#(MXENTRIES),CREDIT#(MXENTRIES),DISPLAY(MXENTRIES)
  18. Dim DESCRIPTOR$(10),COMMENT$(10),GOAL(10),BASE_ACCT$(10)
  19. Dim CAT_TOTALS_DEB#(10),CAT_TOTALS_CRED#(10)
  20. Dim CAT_PERCEN_DEB#(10),CAT_PERCEN_CRED#(10)
  21. Global ACCT$,BGT$,RECNUM,TYPE$,DATE$(),DESCR$(),DEBIT#(),CREDIT#(),DISPLAY(),BASE_ACCT$()
  22. Global CAT_TOTALS_DEB#(),CAT_TOTALS_CRED#()
  23. Global CAT_PERCEN_DEB#(),CAT_PERCEN_CRED#()
  24. Global DISP_TOP,DISP_BOTTOM,VIRT_IDX,PAD
  25. Global DESCRIPTOR$(),COMMENT$(),GOAL(),BGT$,CUR_ACCT
  26. Global R_OT,R_OBA,R_OBU,R_SP,ALL_BALANCE#
  27. '
  28. DISP_TOP=6 : DISP_BOTTOM=23 : Rem data is displayed on editing screen from lines 6 to 23 
  29. VIRT_IDX=1 : Rem this puts us at the first location of display()
  30. DISPLAY(VIRT_IDX)=1 : Rem this sets up our first element in display()
  31. '
  32. '
  33. Procedure VAR_D0CS
  34.    ' base$ is the pathname of the last transaction base that was loaded 
  35.    ' basedir$ is just the path of the base$ - filename is truncated 
  36.    ' basefile$ - is just the file of the base$ - path is truncated    
  37.    ' h0mey is a boolean which shows whether or not h0mescreen is being up to date 
  38.    ' prog$ gives the program name 
  39.    ' ver$ gives the version of prog$  
  40.    ' acct$ holds the name of the current/last acct that was edited
  41.    ' recnum gives the # of entries in current/last acct that was edited 
  42.    ' type$ gives the type of account: "Asset" or "Liability"
  43.    ' date$() is the list of dates from the current/last acct  
  44.    ' descr$() is the list of descriptions from the current/last acct  
  45.    ' debit() is the list of debits from the current/last acct 
  46.    ' credit() is the list of credits from the current/last acct 
  47.    ' display() is the list of index numbers which appear on the screen
  48.    ' Ex:  display(1)=55 shows that record #55 is line 1 of display()
  49.    ' display() is actually a virtual screen as the whole thing can't be displayed at once 
  50.    ' acctwrk$ holds last acct name touched by another function besides edit 
  51.    ' prefs globals: 
  52.    ' for colors - b1,b2,b3,r1,r2,r3,h1,h2,h3,m1,m2,m3   
  53.    ' for printer defaults - lp,pag,ff 
  54.    ' for acct transaction sorting (T/F) - soreted 
  55.    ' for max # of entries in an acct - mxentries  
  56.    ' for type of mouse pointer to use - _mouse: 
  57.    '     1 = arrow (default)
  58.    '     2 = crosshairs 
  59.    '     3 = system mouse pointer 
  60.    ' for default values given to inputs - def_entries 
  61.    '     1 = blank or zeros (default) 
  62.    '     2 = last value entered 
  63.    '     3 = "None" or zeros
  64.    ' for holding the previous values input into a data line in the account editor 
  65.       ' - last_date$, last_descr$
  66.    '
  67.    ' disp_top shows the literal of the top of our editing window
  68.    ' disp_bottom shows the literal of the bottom of our editing window
  69.    ' virt_idx shows where we are on in the virtual screen display() 
  70.    ' pad - boolean which shows whether or not user is in keypad mode in the edit screen 
  71.    ' descriptor$(), comment$(), goal() is for the budget editor 
  72.    ' bgt$ holds name of current budget file 
  73.    ' base_account$ - holds names of accts in current transaction base 
  74.    ' cur_acct - used for indexing in the base editor  
  75.    ' for reports: 
  76.    'r_ot - output transactions? 
  77.    'r_oba - output balance? 
  78.    'r_obu - output budget info? 
  79.    'r_sp - output to screen or printer? 
  80.    'all_balance# - transaction base worth 
  81.    '
  82.    'cat_totals_deb#(),cat_totals_cred#() - for showing the totals of each category of which there can be ten (budgets)
  83.    'cat_percen_deb#(),cat_percen_cred#() - shows how much of debits/credits that a category takes of the account total for debits/credits 
  84. End Proc
  85. Procedure COMMENTS
  86.    '
  87.    '1)
  88.    ' there are 4 different types of files used in this programs for input and 
  89.    ' they all have the following headers (though content afterwards varies):  
  90.    '          
  91.    '        prog$+" "+"{Base, Acct, Prefs, Budget}" 
  92.    '        ver$
  93.    ' this uniformity in headers will allow future versions to ID these files  
  94.    '  and convert or use them 
  95.    '
  96.    '
  97.    '2)
  98.    '  approximately 15 records will fit into each K of memory.  
  99.    '
  100.    '3)
  101.    '  each transaction base is meant to cover only one money tool (e.g. checking, savings, etc.)
  102.    '
  103.    '4)
  104.    '  colors: 
  105.    '             #      purpose 
  106.    '
  107.    '             0      background
  108.    '             1      regular 
  109.    '             2      highlight 
  110.    '             3      menu
  111.    '
  112. End Proc
  113. Procedure INIT
  114.    PROG$="The Home Accountant"
  115.    VER$="1.1"
  116.    Screen Open 0,640,200,4,Hires
  117.    Palette 0,0,0,0 : Cls 
  118.    Flash Off : Rem necessary to manipulate color #3   
  119.    If Exist("s:HomeAccountant.prefs")
  120.       PREFS_LOAD["s:HomeAccountant.prefs"]
  121.    Else 
  122.       PREFS_DEFAULT
  123.    End If 
  124.    Curs Off 
  125.    Pen 1 : Paper 0 : Cls 
  126.    R_OT=False : R_OBA=True : R_OBU=True : R_SP=True
  127.    H0MEY=False
  128. End Proc
  129. '*************************  initialization end  ************************** 
  130. '
  131. '
  132. '*************************  main run loop begin  ************************* 
  133. On Error Proc ERR_CATCH : Rem this routine simply notifies of the error and attempts to redo the line which created the error, may cause an endless loop 
  134. Break Off : Rem we turn off the control-c to save cpu and prevent incomplete files and such
  135. If Not Exist("libs:mathtrans.library")
  136.    N0TICE["I need libs:mathtrans.library to function correctly.",0]
  137.    N0TICE["Unless you have preloaded it, I may quit unexpectedly.",0]
  138. End If 
  139. _STARTING_POINT:
  140. Proc MENU
  141. Goto _STARTING_POINT
  142. '*************************  main run loop end  *************************** 
  143. '
  144. '
  145. '*************************  procs begin  ********************************* 
  146. Procedure H0MESCREEN
  147.    Curs Off 
  148.    Screen 0
  149.    Cls 
  150.    Locate ,7 : Centre("Welcome to ") : Print 
  151.    Locate 27, : Pen 2 : Print PROG$;" v";VER$ : Pen 1
  152.    B$=Chr$(169)+" 1992, 1993 DragonWarez"
  153.    Locate ,9 : Centre B$
  154.    Locate ,12 : Centre "Make your choice from above."
  155.    H0MEY=True
  156. End Proc
  157. Procedure MENU
  158.    BEGINMENU:
  159.    If Not(H0MEY) Then H0MESCREEN
  160.    Menu Del 
  161.    Pen 3
  162.    Menu Static 2 : Rem lock all menus into place  
  163.    Inverse On 
  164.    Menu$(1)=" File "
  165.    Menu$(1,1)=" Open Existing Transaction Base  o "
  166.    Menu Key(1,1) To 24
  167.    Menu$(1,2)=" Create New Transaction Base     c "
  168.    Menu Key(1,2) To 51
  169.    Menu$(1,3)=" Quit                            z "
  170.    Menu Key(1,3) To 49
  171.    Menu$(1,4)=" About                           a "
  172.    Menu Key(1,4) To 32
  173.    Menu$(2)=" Editing "
  174.    Menu$(2,1)=" Edit Transaction Base      t "
  175.    Menu Key(2,1) To 20
  176.    Menu$(2,2)=" Edit An Account            e "
  177.    Menu Key(2,2) To 18
  178.    Menu$(2,3)=" Edit A Budget              b "
  179.    Menu Key(2,3) To 53
  180.    Menu$(3)=" Reports "
  181.    Menu$(3,1)=" For a single account              i "
  182.    Menu Key(3,1) To 23 : Rem "i"
  183.    Menu$(3,2)=" For the whole transaction base    r "
  184.    Menu Key(3,2) To 19 : Rem "r"
  185.    '
  186.    '
  187.    ' prefs is #8 because we may want to use 9 for " Help " and this leaves  
  188.    '   #'s 4-7 open for future add-ons
  189.    Menu$(8)=" Prefs "
  190.    Menu$(8,1)=" Colors            1 "
  191.    Menu Key(8,1) To 1
  192.    Menu$(8,2)=" Printer Setup     2 "
  193.    Menu Key(8,2) To 2
  194.    Menu$(8,3)=" Sorting           3 "
  195.    Menu Key(8,3) To 3
  196.    Menu$(8,4)=" Max # of Entries  4 "
  197.    Menu Key(8,4) To 4
  198.    Menu$(8,5)=" Default Entries   5 "
  199.    Menu Key(8,5) To 5
  200.    Menu$(8,6)=" Mouse Pointer     6 "
  201.    Menu Key(8,6) To 6
  202.    Menu$(8,7)=" Load Prefs        7 "
  203.    Menu Key(8,7) To 7
  204.    Menu$(8,8)=" Save Prefs        8 "
  205.    Menu Key(8,8) To 8
  206.    Menu$(8,9)=" Default Prefs     9 "
  207.    Menu Key(8,9) To 9
  208.    Inverse Off 
  209.    Menu On 
  210.    Pen 1
  211.    '
  212.    Do 
  213.       Multi Wait 
  214.       If Not(H0MEY) Then H0MESCREEN
  215.       Do 
  216.          Multi Wait 
  217.          Exit If Choice
  218.       Loop 
  219.       Menu Off 
  220.       '
  221.       If Choice(1)=1
  222.          If Choice(2)=1
  223.             BASE_OPEN
  224.          End If 
  225.          If Choice(2)=2
  226.             BASE_CREATE[""]
  227.          End If 
  228.          If Choice(2)=3
  229.             QUIT
  230.          End If 
  231.          If Choice(2)=4
  232.             ABOUT
  233.          End If 
  234.       End If 
  235.       '
  236.       If Choice(1)=2
  237.          If Choice(2)=1
  238.             BASE_EDIT
  239.          End If 
  240.          If Choice(2)=2
  241.             ' for this one we need to actually destroy the current menu
  242.             '    then leave this proc in a linear non-returnable fashion   
  243.             Menu Off : Menu Del : Cls 
  244.             ACCT_EDIT_OPEN[""]
  245.             If Param : Rem if acct_edit_open succeeded
  246.                H0MEY=False : Rem reset the screen when we get there 
  247.                Proc ACCT_EDIT : ACCT_EDIT_QUIT
  248.             Else 
  249.                H0MEY=False
  250.                ACCT$="" : Rem return it to normal just in case anything checks to see if it's empty
  251.             End If 
  252.             Goto BEGINMENU
  253.          End If 
  254.          If Choice(2)=3
  255.             BUDGET
  256.          End If 
  257.       End If 
  258.       '
  259.       If Choice(1)=3
  260.          If Choice(2)=1
  261.             REPORT_ACCT
  262.          End If 
  263.          If Choice(2)=2
  264.             REPORT_ALL
  265.          End If 
  266.       End If 
  267.       '
  268.       If Choice(1)=8
  269.          If Choice(2)=1
  270.             PREFS_COLORS
  271.          End If 
  272.          If Choice(2)=2
  273.             PREFS_PRINTER
  274.          End If 
  275.          If Choice(2)=3
  276.             PREFS_SORTING
  277.          End If 
  278.          If Choice(2)=4
  279.             PREFS_MAXENTRIES
  280.          End If 
  281.          If Choice(2)=5
  282.             PREFS_DEF_VALUES
  283.          End If 
  284.          If Choice(2)=6
  285.             PREFS_MOUSE
  286.          End If 
  287.          If Choice(2)=7
  288.             PREFS_LOAD[""]
  289.          End If 
  290.          If Choice(2)=8
  291.             PREFS_SAVE
  292.          End If 
  293.          If Choice(2)=9
  294.             PREFS_DEFAULT
  295.          End If 
  296.       End If 
  297.       '
  298.       Menu On 
  299.    Loop 
  300.    ' this instruction only executed when menu option 2,3 selected which breaks
  301. End Proc
  302. Procedure ERR_CATCH
  303.    N0TICE["Error #"+Right$(Str$(Errn),2)+" has occured.  Contact the author.",0]
  304.    N0TICE["Attempting to resume activity.",0]
  305.    Resume 
  306. End Proc
  307. Procedure ABOUT
  308.    H0MEY=False : Cls 
  309.    Locate 0,1
  310.    Pen 2
  311.    Centre(PROG$+" "+VER$) : Print 
  312.    Centre("About Screen")
  313.    Centre(Chr$(169)+" 1992, 1993 DragonWarez")
  314.    Print : Print : Print : Print : Pen 1
  315.    Centre("    This program is Freeware and offered to the Amiga community free of charge.") : Print 
  316.    Centre("    No charge is to be made for this program distribution.") : Print : Print 
  317.    Print "     To contact me by mail my address is:" : Print 
  318.    Print "                             Vincent Platt"
  319.    Print "                             908 - 18th St North"
  320.    Print "                             Moorhead, MN  56560"
  321.    Print "                             USA" : Print : Print 
  322.    Print "     By email on the Internet my address is:" : Print 
  323.    Print "                             platt@mhd1.moorhead.msus.edu"
  324.    CONTINUE
  325. End Proc
  326. '
  327. ' the following procs cover the use of transaction bases 
  328. Procedure BASE_OPEN
  329.    H0MEY=False
  330.    Clear Key 
  331.    TMP$=Fsel$("","","Choose your Transaction Base","(directory)")
  332.    If TMP$="" Then Pop Proc
  333.    If Exist(TMP$)
  334.       Open In 1,TMP$
  335.       Input #1,CK$
  336.       If CK$<>(PROG$+" Base")
  337.          N0TICE["You have not chosen a transaction base.",0]
  338.          Close 1 : Pop Proc
  339.       End If 
  340.       Input #1,V$ : Rem versions don't matter yet
  341.       Input #1,BASEDIR$
  342.       For X=1 To 10
  343.          Input #1,BASE_ACCT$(X)
  344.       Next X
  345.       Close 1
  346.       BASE$=TMP$ : Rem ok to make it global now 
  347.       ' find the basefile$ 
  348.       G_NAME[TMP$,"file"]
  349.       BASEFILE$=Param$
  350.       Pop Proc
  351.    End If 
  352.    _NEWBASE:
  353.    Cls 
  354.    YN["No such base.  Would you like me to create it?"]
  355.    If Param
  356.       BASE_CREATE[TMP$]
  357.    Else 
  358.       Pop Proc
  359.    End If 
  360. End Proc
  361. Procedure BASE_CREATE[TMP$]
  362.    H0MEY=False : If TMP$<>"" Then Goto A
  363.    Clear Key 
  364.    TMP$=Fsel$("","","Select new base's location and name.","")
  365.    If TMP$="" Then Pop Proc
  366.    If Exist(TMP$)
  367.       YN["Do you want to write over "+TMP$+"?"]
  368.       If Not Param
  369.          Pop Proc
  370.       End If 
  371.    End If 
  372.    If(Param) or(TMP$<>"")
  373.       A:
  374.       ' make dir "new" then make file "new.Base" 
  375.       Mkdir TMP$ : BASEDIR$=TMP$
  376.       TMP$=TMP$+".Base"
  377.       Open Out 1,TMP$
  378.       Print #1,PROG$+" Base" : Print #1,VER$ : Print #1,BASEDIR$
  379.       ' set up our globals for the base strings
  380.       BASE$=TMP$
  381.       G_NAME[TMP$,"file"] : BASEFILE$=Param$
  382.       For X=1 To 10
  383.          Print #1,BASE_ACCT$(X)
  384.       Next X
  385.       Close 1
  386.       ' this is a success test since mkdir doesn't return a value
  387.       If Not Exist(BASEDIR$)
  388.          N0TICE["Invalid base name.  Write failed.",0]
  389.          BASE$="" : BASEDIR$="" : BASEFILE$=""
  390.          Pop Proc
  391.       End If 
  392.    End If 
  393. End Proc
  394. Procedure BASE_SAVE[TMP$]
  395.    N0TICE["Saving transaction base: "+TMP$+".",1]
  396.    Open Out 1,TMP$ : Print #1,PROG$+" Base" : Print #1,VER$ : Print #1,BASEDIR$
  397.    For X=1 To 10
  398.       Print #1,BASE_ACCT$(X)
  399.    Next X
  400.    Close 1
  401. End Proc
  402. Procedure BASE_EDIT
  403.    If BASE$=""
  404.       N0TICE["You do not have a Transaction Base opened.",0]
  405.       YN["Would you like to open one?"]
  406.       If Param
  407.          BASE_OPEN
  408.       End If 
  409.    End If 
  410.    If BASE$=""
  411.       Pop Proc
  412.    End If 
  413.    Cls 
  414.    Reserve Zone 
  415.    Reserve Zone 14
  416.    _REFRESHSCREEN:
  417.    Cls 
  418.    Locate ,2
  419.    Centre(Border$("Transaction Base Editing Screen",1))
  420.    For Y=1 To 10
  421.       If BASE_ACCT$(Y)=""
  422.          C$=Space$(50)
  423.       Else 
  424.          C$=BASE_ACCT$(Y)
  425.       End If 
  426.       A$=Chr$(176)+"  "+C$
  427.       Locate 1,Y+7 : Print Zone$(A$,Y)
  428.    Next Y
  429.    Locate 9,20 : Print Border$(Zone$("SAVE",11),1)
  430.    Locate 28,20 : Print Border$(Zone$("ADD",12),1)
  431.    Locate 46,20 : Print Border$(Zone$("DELETE",13),1)
  432.    Locate 65,20 : Print Border$(Zone$("QUIT",14),1)
  433.    CUR_ACCT=0
  434.    Do 
  435.       Multi Wait 
  436.       M=Mouse Zone
  437.       If Mouse Click
  438.          If(M=>1) and(M<=10)
  439.             ' turn new one on, turn old one off, then switch the pointer 
  440.             ' find shape of new one then turn it on
  441.             If BASE_ACCT$(M)=""
  442.                C$=Space$(50)
  443.             Else 
  444.                C$=BASE_ACCT$(M)
  445.             End If 
  446.             A$=Chr$(176)+"  "+C$
  447.             Locate 1,M+7 : Inverse On : Print Zone$(A$,M) : Inverse Off 
  448.             ' find shape of old one then turn it off 
  449.             If CUR_ACCT<>0
  450.                If BASE_ACCT$(CUR_ACCT)=""
  451.                   C$=Space$(50)
  452.                Else 
  453.                   C$=BASE_ACCT$(CUR_ACCT)
  454.                End If 
  455.                A$=Chr$(176)+"  "+C$
  456.                Locate 1,CUR_ACCT+7 : Print Zone$(A$,CUR_ACCT)
  457.             End If 
  458.             ' if we reselected this switch then we are trying to turn it off:= cur_Acct=0  
  459.             If CUR_ACCT=M
  460.                CUR_ACCT=0
  461.             Else 
  462.                CUR_ACCT=M
  463.             End If 
  464.          End If 
  465.          If M=11
  466.             BASE_SAVE[BASE$]
  467.             Goto _REFRESHSCREEN
  468.          End If 
  469.          If(M=12) and(CUR_ACCT<>0)
  470.             If BASE_ACCT$(CUR_ACCT)<>""
  471.                N0TICE["You must delete the current account before you add an account in its place.",0]
  472.                Goto _REFRESHSCREEN
  473.             End If 
  474.             ACCT_ADD
  475.             BASE_ACCT$(CUR_ACCT)=Param$
  476.             ' prevent a faulty name, or having the base chosen by accident 
  477.             If(Right$(BASE_ACCT$(CUR_ACCT),1)="/") or(BASE$=BASE_ACCT$(CUR_ACCT))
  478.                BASE_ACCT$(CUR_ACCT)=""
  479.             End If 
  480.             Goto _REFRESHSCREEN
  481.          End If 
  482.          If(M=13) and(CUR_ACCT<>0)
  483.             ' empty the string 
  484.             BASE_ACCT$(CUR_ACCT)=""
  485.             Goto _REFRESHSCREEN
  486.          End If 
  487.          If M=14
  488.             BASE_SAVE[BASE$]
  489.             H0MEY=False : Pop Proc : Rem in case we said no to save 
  490.          End If 
  491.       End If 
  492.    Loop 
  493.    Reserve Zone : H0MEY=False
  494. End Proc
  495. Procedure QUIT
  496.    YN["Are you sure you want to quit?"]
  497.    If Param Then Cls : Screen Close 0 : Edit 
  498. End Proc
  499. '
  500. '
  501. ' the following procs cover the use of accounts  
  502. Procedure ACCT_ADD
  503.    Clear Key 
  504.    ACCTWRK$=Fsel$(BASEDIR$,"Unnamed","Give name for new acc't.","")
  505.    If ACCTWRK$="" Then Pop Proc
  506.    ' here it is possible to add in an account which already exists, we check it to be sure it is an account 
  507.    If Exist(ACCTWRK$)
  508.       Open In 1,ACCTWRK$
  509.       Line Input #1,P$
  510.       Close 1
  511.       If P$<>(PROG$+" Acct")
  512.          N0TICE["This is not an account.  Operation terminated.",0]
  513.          ACCTWRK$="" : Goto _ENDING
  514.       End If 
  515.       Goto _ENDING
  516.    Else 
  517.       ACCTWRK$=ACCTWRK$+".Acct"
  518.       Open Out 1,ACCTWRK$
  519.       Print #1,PROG$+" Acct"
  520.       Print #1,"new" : Rem normally this is the version string
  521.       Print #1,1 : Rem this is the actual number of records 
  522.       Print #1,SORETED
  523.       Print #1,"Liability"
  524.       Close 1
  525.    End If 
  526.    ' this is a success test since mkdir doesn't return a value
  527.    If Not(Exist(ACCTWRK$))
  528.       N0TICE["Invalid directory name.  Create failed.",0]
  529.       ACCTWRK$=""
  530.       Pop Proc
  531.    End If 
  532.    _ENDING:
  533. End Proc[ACCTWRK$]
  534. Procedure ACCT_EDIT
  535.    ' this part initializes the screen 
  536.    Menu Off : Menu Del 
  537.    Pen 3 : Inverse On 
  538.    Menu$(1)=" File "
  539.    Menu$(1,1)=" Open Acct            o "
  540.    Menu Key(1,1) To 24
  541.    Menu$(1,2)=" Save Current Acct    s "
  542.    Menu Key(1,2) To 33
  543.    Menu$(1,3)=" Quit Edit            q "
  544.    Menu Key(1,3) To 16
  545.    Menu$(1,4)=" View Acct Balance    v "
  546.    Menu Key(1,4) To 52
  547.    Menu$(2)=" Edit "
  548.    Menu$(2,1)=" Kill A Transaction   k "
  549.    Menu$(2,2)=" Insert A Transaction i "
  550.    Menu$(2,3)=" Change Account Type  t "
  551.    Menu$(2,4)=" Refresh Screen       r "
  552.    Menu$(2,5)=" Move up the list     Up-Arrow   "
  553.    Menu$(2,6)=" Move down the list   Down-Arrow "
  554.    Menu$(2,7)=" Edit current entry   Return     "
  555.    PAD=False : Rem default value
  556.    Menu$(2,8)=" Turn Keypad Mode ON    F1       "
  557.    Menu Key(2,1) To 39
  558.    Menu Key(2,2) To 23
  559.    Menu Key(2,3) To 20
  560.    Menu Key(2,4) To 19
  561.    Menu Key(2,5) To 76
  562.    Menu Key(2,6) To 77
  563.    Menu Key(2,7) To 68
  564.    Menu Key(2,8) To 80
  565.    Inverse Off 
  566.    ' here is our central choice routine 
  567.    '  - it allows use of the menus, up/down arrow keys, and return
  568.    _STARTOFMENU:
  569.    Do 
  570.       Multi Wait 
  571.       Menu On 
  572.       Clear Key 
  573.       If Not H0MEY
  574.          ACCT_EDIT_REFRESH
  575.       End If 
  576.       Do 
  577.          Multi Wait 
  578.          Exit If Choice
  579.       Loop 
  580.       Menu Off 
  581.       If Choice(1)=1
  582.          If Choice(2)=1
  583.             ACCT_EDIT_QUIT
  584.             Cls 
  585.             ACCT_EDIT_OPEN[""]
  586.             ACCT_EDIT_REFRESH
  587.          End If 
  588.          If Choice(2)=2
  589.             ACCT_EDIT_SAVE
  590.          End If 
  591.          If Choice(2)=3
  592.             Exit 
  593.          End If 
  594.          If Choice(2)=4
  595.             ACCT_EDIT_BALANCE[True]
  596.          End If 
  597.       End If 
  598.       If Not PAD
  599.          If Choice(1)=2
  600.             If Choice(2)=1
  601.                ACCT_EDIT_KILL
  602.             End If 
  603.             If Choice(2)=2
  604.                ACCT_EDIT_INSERT
  605.             End If 
  606.             If Choice(2)=3
  607.                If TYPE$="Liability"
  608.                   TYPE$="Asset"
  609.                Else 
  610.                   TYPE$="Liability"
  611.                End If 
  612.                Locate 60,3 : Print Space$(15)
  613.                Locate 60,3 : Print "Type: ";TYPE$
  614.             End If 
  615.             If Choice(2)=4
  616.                H0MEY=False
  617.                ACCT_EDIT_REFRESH
  618.             End If 
  619.             If Choice(2)=5
  620.                ACCT_EDIT_UP
  621.             End If 
  622.             If Choice(2)=6
  623.                ACCT_EDIT_DOWN
  624.             End If 
  625.             If Choice(2)=7
  626.                ACCT_EDIT_CURRENT
  627.             End If 
  628.             If Choice(2)=8
  629.                PAD=True : Menu Del(2)
  630.                Pen 3 : Inverse On 
  631.                Menu$(2)=" Keypad Options "
  632.                Menu$(2,1)=" Insert        + "
  633.                Menu$(2,2)=" Kill          - "
  634.                Menu$(2,3)=" Up            Cursor-Up "
  635.                Menu$(2,4)=" Down          Cursor-Down "
  636.                Menu$(2,5)=" Beginning     Home "
  637.                Menu$(2,6)=" End           End "
  638.                Menu$(2,7)=" Refresh       * "
  639.                Menu$(2,8)=" Edit Current  Enter "
  640.                Menu$(2,9)=" Page up       PgUp "
  641.                Menu$(2,10)=" Page Down     PgDn "
  642.                Menu$(2,11)=" Turn Keypad Mode OFF   F1 "
  643.                Inverse Off : Pen 1
  644.                Menu Key(2,1) To 94
  645.                Menu Key(2,2) To 74
  646.                Menu Key(2,3) To 62
  647.                Menu Key(2,4) To 30
  648.                Menu Key(2,5) To 61
  649.                Menu Key(2,6) To 29
  650.                Menu Key(2,7) To 93
  651.                Menu Key(2,8) To 67
  652.                Menu Key(2,9) To 63
  653.                Menu Key(2,10) To 31
  654.                Menu Key(2,11) To 80
  655.                Goto _STARTOFMENU
  656.             End If 
  657.          End If 
  658.          ' if pad 
  659.       Else 
  660.          If Choice(1)=2
  661.             If Choice(2)=1
  662.                ACCT_EDIT_INSERT
  663.             End If 
  664.             If Choice(2)=2
  665.                ACCT_EDIT_KILL
  666.             End If 
  667.             If Choice(2)=3
  668.                ACCT_EDIT_UP
  669.             End If 
  670.             If Choice(2)=4
  671.                ACCT_EDIT_DOWN
  672.             End If 
  673.             If Choice(2)=5
  674.                ACCT_EDIT_HOME
  675.             End If 
  676.             If Choice(2)=6
  677.                ACCT_EDIT_END
  678.             End If 
  679.             If Choice(2)=7
  680.                H0MEY=False
  681.                ACCT_EDIT_REFRESH
  682.             End If 
  683.             If Choice(2)=8
  684.                ACCT_EDIT_CURRENT
  685.             End If 
  686.             If Choice(2)=9
  687.                ACCT_EDIT_PGUP
  688.             End If 
  689.             If Choice(2)=10
  690.                ACCT_EDIT_PGDN
  691.             End If 
  692.             If Choice(2)=11
  693.                PAD=False : Menu Del(2)
  694.                ' put old type menus here with old scancodes   
  695.                Pen 3 : Inverse On 
  696.                Menu$(2)=" Edit "
  697.                Menu$(2,1)=" Kill A Transaction   k "
  698.                Menu$(2,2)=" Insert A Transaction i "
  699.                Menu$(2,3)=" Change Account Type  t "
  700.                Menu$(2,4)=" Refresh Screen       r "
  701.                Menu$(2,5)=" Move up the list     Up-Arrow  "
  702.                Menu$(2,6)=" Move down the list   Down-Arrow "
  703.                Menu$(2,7)=" Edit current entry   Return     "
  704.                Menu$(2,8)=" Turn Keypad Mode ON    F1 "
  705.                Inverse Off : Pen 1
  706.                Menu Key(2,1) To 39
  707.                Menu Key(2,2) To 23
  708.                Menu Key(2,3) To 20
  709.                Menu Key(2,4) To 19
  710.                Menu Key(2,5) To 76
  711.                Menu Key(2,6) To 77
  712.                Menu Key(2,7) To 68
  713.                Menu Key(2,8) To 80
  714.                Goto _STARTOFMENU
  715.             End If 
  716.          End If 
  717.       End If 
  718.       Clear Key 
  719.       Menu On 
  720.    Loop 
  721.    '
  722.    '
  723.    H0MEY=False
  724. End Proc
  725. '
  726. ' these procedures pertain only to proc acct_edit
  727. Procedure ACCT_EDIT_OPEN[FILE$]
  728.    RET=True
  729.    Clear Key 
  730.    If FILE$=""
  731.       FILE$=Fsel$(BASEDIR$,"","Choose Account","")
  732.    End If 
  733.    If FILE$=""
  734.       RET=False
  735.       Goto _ENDING
  736.    End If 
  737.    If Not Exist(FILE$)
  738.       N0TICE["Account does not exist.",0]
  739.       RET=False
  740.       Goto _ENDING
  741.    End If 
  742.    ACCT$=FILE$ : Rem make it global since it's ok now   
  743.    'read in checking string 
  744.    Open In 1,ACCT$
  745.    Line Input #1,CK$
  746.    If CK$<>(PROG$+" Acct")
  747.       N0TICE["This is not a Home Accountant Account File.",0]
  748.       Close 1 : RET=False : Goto _ENDING
  749.    End If 
  750.    ' here we read in the rest of the header, but version is ignored 
  751.    '  because we don't care at this point.
  752.    Line Input #1,V$
  753.    Line Input #1,RECNUM,INS,TYPE$
  754.    ' clear out previous data before getting new data
  755.    '  we put this here because we need to absolutely be sure its a valid
  756.    '   load before we clear data - this way if it's a bad load then we can
  757.    '   keep our present data
  758.    For X=1 To MXENTRIES Step 1
  759.       DATE$(X)="" : DESCR$(X)="" : DEBIT#(X)=0.0 : CREDIT#(X)=0.0
  760.    Next X
  761.    If V$="new"
  762.       Goto _CLEAROTHERS : Rem we're done loading if its new
  763.    End If 
  764.    If RECNUM>MXENTRIES
  765.       N0TICE["Too many records in Account File.  Redo prefs then restart Home Accountant.",0]
  766.       A$=Str$(RECNUM)
  767.       N0TICE[ACCT$+" has "+A$+" records.",0]
  768.       Close 1 : RET=False : Goto _ENDING
  769.    End If 
  770.    If INS<>SORETED
  771.       YN["Change sort pref to that of the account?"]
  772.       If Param
  773.          SORETED=INS
  774.       End If 
  775.    End If 
  776.    N0TICE["Loading "+ACCT$+".",1]
  777.    For X=1 To RECNUM Step 1
  778.       ' get out if file pointer is at end - data or no data
  779.       If Eof(1)
  780.          Goto _CLEAROTHERS
  781.       End If 
  782.       Line Input #1,DATE$(X),DESCR$(X),DEBIT#(X),CREDIT#(X)
  783.       DISPLAY(X)=X : Rem display() now equals correct order because at first we want them as input
  784.    Next X
  785.    _CLEAROTHERS:
  786.    Close 1
  787.    ' we send it down here so the value may be returned w/ the end proc statement
  788.    _ENDING:
  789. End Proc[RET]
  790. Procedure ACCT_EDIT_SAVE
  791.    If ACCT$<>""
  792.       N0TICE["File being saved as "+ACCT$+".",1]
  793.       Open Out 1,ACCT$
  794.       Print #1,PROG$+" Acct"
  795.       Print #1,VER$
  796.       Print #1,RECNUM
  797.       Print #1,SORETED
  798.       Print #1,TYPE$
  799.       ' this is here to make sure the first record gets saved if recnum=1
  800.       CUR=DISPLAY(1)
  801.       If RECNUM=1
  802.          Print #1,DATE$(CUR)
  803.          Print #1,DESCR$(CUR)
  804.          Print #1,DEBIT#(CUR)
  805.          Print #1,CREDIT#(CUR)
  806.          Goto _ENDING
  807.       End If 
  808.       If SORETED=True
  809.          ACCT_EDIT_SORT
  810.       End If 
  811.       N0TICE["Writing records...",1]
  812.       For X=1 To RECNUM Step 1
  813.          ' strip out blank records
  814.          If Not((DATE$(X)="") and(DESCR$(X)="") and(DEBIT#(X)=0) and(CREDIT#(X)=0))
  815.             Print #1,DATE$(X)
  816.             Print #1,DESCR$(X)
  817.             Print #1,DEBIT#(X)
  818.             Print #1,CREDIT#(X)
  819.          End If 
  820.       Next X
  821.       _ENDING:
  822.       Close 1
  823.    End If 
  824. End Proc
  825. Procedure ACCT_EDIT_SORT
  826.    N0TICE["Sorting records...",1]
  827.    For LUPE1=1 To(RECNUM-1)
  828.       SMALL=LUPE1
  829.       For LUPE2=(LUPE1+1) To RECNUM
  830.          If(DATE$(LUPE2))<(DATE$(SMALL))
  831.             SMALL=LUPE2
  832.          Else 
  833.             If DATE$(LUPE2)=DATE$(SMALL)
  834.                If DESCR$(LUPE2)=DESCR$(SMALL)
  835.                   SMALL=LUPE2
  836.                End If 
  837.             End If 
  838.          End If 
  839.       Next LUPE2
  840.       Swap DATE$(LUPE1),DATE$(SMALL)
  841.       Swap DESCR$(LUPE1),DESCR$(SMALL)
  842.       Swap DEBIT#(LUPE1),DEBIT#(SMALL)
  843.       Swap CREDIT#(LUPE1),CREDIT#(SMALL)
  844.    Next LUPE1
  845.    ' this resets the display to a sorted display
  846.    For X=1 To RECNUM
  847.       DISPLAY(X)=X
  848.    Next X
  849.    VIRT_IDX=1 : Rem start display with first record in display() 
  850. End Proc
  851. Procedure ACCT_EDIT_QUIT
  852.    H0MEY=False
  853.    YN["Would you like to save first?"]
  854.    If Param
  855.       ACCT_EDIT_SAVE
  856.    End If 
  857.    ACCT$=""
  858. End Proc
  859. Procedure ACCT_EDIT_BALANCE[ALL]
  860.    ALL_CREDIT#=0.0
  861.    ALL_DEBIT#=0.0
  862.    For X=1 To MXENTRIES
  863.       ALL_CREDIT#=ALL_CREDIT#+CREDIT#(X)
  864.       ALL_DEBIT#=ALL_DEBIT#+DEBIT#(X)
  865.    Next X
  866.    If ALL
  867.       Cls 
  868.       Locate ,8
  869.       H0MEY=False
  870.       Centre(Border$("Balance for: "+ACCT$+".",1))
  871.       Locate ,12
  872.    End If 
  873.    BAL#=ALL_CREDIT#-ALL_DEBIT#
  874.    B$=Str$(BAL#)
  875.    If ALL
  876.       Centre(B$)
  877.       Locate ,20
  878.       CONTINUE
  879.    End If 
  880. End Proc[B$]
  881. Procedure ACCT_EDIT_KILL
  882.    ' clears the data out of the deleted record  
  883.    CUR=DISPLAY(VIRT_IDX) : Rem record we are about to kill is the record we are sitting on
  884.    DATE$(CUR)="" : DESCR$(CUR)="" : DEBIT#(CUR)=0 : CREDIT#(CUR)=0 : Rem mark that data as deleted
  885.    ' shifts display() from that record down, up towards that space to delete it from the virtual display  
  886.    For X=VIRT_IDX To MXENTRIES-1 Step 1
  887.       DISPLAY(X)=DISPLAY(X+1)
  888.    Next X
  889.    'if we're at the end of list then we need to go back up one when we delete 
  890.    ' or it'll screw up our screen 
  891.    If(VIRT_IDX=RECNUM) and(RECNUM>1)
  892.       Dec VIRT_IDX
  893.    End If 
  894.    If RECNUM>1
  895.       Dec RECNUM
  896.    End If 
  897.    ACCT_EDIT_REFRESH
  898. End Proc
  899. Procedure ACCT_EDIT_INSERT
  900.    'check to see if we're already at max size for the account 
  901.    'get out if we are after displaying a message
  902.    'if display(mxentries) has something in it then our virtual screen is full 
  903.    CUR=DISPLAY(MXENTRIES)
  904.    ' if the cur has an assigned number and there are some signs of life then, too much!!
  905.    If(CUR<>0)
  906.       N0TICE["You would have too many entries in your account.",0]
  907.       N0TICE["Save your account, change your prefs, and restart.",0]
  908.       Pop Proc
  909.    End If 
  910.    'move display() down one line
  911.    For X=MXENTRIES To(VIRT_IDX+1) Step -1
  912.       DISPLAY(X)=DISPLAY(X-1)
  913.    Next X
  914.    '
  915.    'find next spot in record list for new record by scanning date$ w/a loop 
  916.    'date$(x)="" and descr$(x)="" and debit(x)=0 and credit(x)=0 then good spot  
  917.    '
  918.    ' find a good location 
  919.    For X=1 To MXENTRIES Step 1
  920.       If(DATE$(X)="") and(DESCR$(X)="") and(DEBIT#(X)=0) and(CREDIT#(X)=0)
  921.          DISPLAY(VIRT_IDX)=X
  922.          Exit 
  923.       End If 
  924.    Next X
  925.    '
  926.    CUR=DISPLAY(VIRT_IDX)
  927.    DATE$(CUR)="" : DESCR$(CUR)="" : DEBIT#(CUR)=0.0 : CREDIT#(CUR)=0.0
  928.    Inc RECNUM
  929.    ACCT_EDIT_REFRESH
  930.    ACCT_EDIT_LINEGET
  931.    ACCT_EDIT_REFRESH
  932. End Proc
  933. Procedure ACCT_EDIT_UP
  934.    '  of the edit window then it refreshes the window one up the list - if it 
  935.    '  is at the top of the list then it just beeps atcha..  
  936.    If VIRT_IDX=1 Then Bell : Pop Proc : Rem no go if at the top already
  937.    Dec VIRT_IDX
  938.    ACCT_EDIT_REFRESH
  939. End Proc
  940. Procedure ACCT_EDIT_DOWN
  941.    ' this is the same as acct_edit_down 'cept it works the other way... 
  942.    If VIRT_IDX=RECNUM Then Bell : Pop Proc : Rem no go if at the bottom already 
  943.    Inc VIRT_IDX
  944.    ACCT_EDIT_REFRESH
  945. End Proc
  946. Procedure ACCT_EDIT_CURRENT
  947.    'allows current record to be edited  
  948.    ACCT_EDIT_LINEGET
  949.    ACCT_EDIT_REFRESH
  950.    '
  951. End Proc
  952. Procedure ACCT_EDIT_HOME
  953.    VIRT_IDX=1
  954.    ACCT_EDIT_REFRESH
  955. End Proc
  956. Procedure ACCT_EDIT_END
  957.    VIRT_IDX=RECNUM
  958.    ACCT_EDIT_REFRESH
  959. End Proc
  960. Procedure ACCT_EDIT_PGUP
  961.    VIRT_IDX=VIRT_IDX-18
  962.    If VIRT_IDX<1 Then VIRT_IDX=1
  963.    ACCT_EDIT_REFRESH
  964. End Proc
  965. Procedure ACCT_EDIT_PGDN
  966.    VIRT_IDX=VIRT_IDX+18
  967.    If VIRT_IDX>RECNUM Then VIRT_IDX=RECNUM
  968.    ACCT_EDIT_REFRESH
  969. End Proc
  970. Procedure ACCT_EDIT_REFRESH
  971.    ' we'll refresh starting with the top of the window which is 8 lines above in display()
  972.    ' rec will be our temp indexer for display() and line is for the screen
  973.    If Not H0MEY
  974.       H0MEY=True
  975.       Cls : CLEARED=True : Pen 1
  976.       Locate 0,1
  977.       Centre(Border$("Account Editing Screen",1)) : Print : Print 
  978.       G_NAME[ACCT$,"file"]
  979.       Print "Account Name: ";Param$ : Locate 60,3 : Print "Type: ";TYPE$
  980.       Under On 
  981.       Locate 2,5 : Print "Date or ID";
  982.       Locate 13, : Print "          Description         ";
  983.       Locate 44, : Print "    Debit    ";
  984.       Locate 58, : Print "   Credit    "
  985.       Under Off 
  986.       Pen 1
  987.       Ink 1
  988.       Locate 0,14 : Print "->"
  989.    End If 
  990.    ' screen setup is now done 
  991.    '
  992.    ' the virt_idx is at line 14 and the top is at disp_top so   
  993.    '  we want to start at the top of the window 
  994.    REC=VIRT_IDX-8
  995.    For X=DISP_TOP To DISP_BOTTOM Step 1
  996.       ' first we print just a space$ if we are in a no data area then skip to the end
  997.       ' second, we have data so we print it out
  998.       If(REC<1) or(REC>RECNUM) or(REC>MXENTRIES)
  999.          If CLEARED
  1000.             Goto _ENDOFFOR
  1001.          End If 
  1002.          Locate 3,X : Print Space$(8)
  1003.          Locate 14,X : Print Space$(30)
  1004.          Locate 45,X : Print Space$(12)
  1005.          Locate 59,X : Print Space$(12)
  1006.          Goto _ENDOFFOR
  1007.       End If 
  1008.       '
  1009.       'get the current record from our virtual screen and print out on actual screen 
  1010.       CUR=DISPLAY(REC)
  1011.       Locate 3,X : Print DATE$(CUR); : Print Space$(8-Len(DATE$(CUR)))
  1012.       Locate 14,X : Print DESCR$(CUR); : Print Space$(30-Len(DATE$(CUR)))
  1013.       Locate 45,X
  1014.       If DEBIT#(CUR)<>0.0
  1015.          S$=Right$(Str$(DEBIT#(CUR)),Len(Str$(DEBIT#(CUR)))-1)
  1016.          Print S$;
  1017.          Print Space$(12-Len(S$))
  1018.       Else 
  1019.          ' this will speed whole screen refreshes 
  1020.          If Not CLEARED
  1021.             Print Space$(12)
  1022.          End If 
  1023.       End If 
  1024.       Locate 59,X
  1025.       If CREDIT#(CUR)<>0.0
  1026.          S$=Right$(Str$(CREDIT#(CUR)),Len(Str$(CREDIT#(CUR)))-1)
  1027.          Print S$;
  1028.          Print Space$(12-Len(S$))
  1029.       Else 
  1030.          If Not CLEARED
  1031.             Print Space$(12)
  1032.          End If 
  1033.       End If 
  1034.       _ENDOFFOR:
  1035.       'get ready for next iteration
  1036.       Inc REC
  1037.       CLEARED=False : Rem we have completed an iteration without clsing
  1038.    Next X
  1039. End Proc
  1040. Procedure ACCT_EDIT_LINEGET
  1041.    Writing 0
  1042.    CUR=DISPLAY(VIRT_IDX)
  1043.    '
  1044.    ' for each one we get the new string and place it in its destination 
  1045.    '  then we change it if its empty and our pref says so 
  1046.    '
  1047.    Locate 3,14
  1048.    STRINGGET[DATE$(CUR),8]
  1049.    DATE$(CUR)=Param$
  1050.    If(DEF_ENTRIES=2) and(DATE$(CUR)="")
  1051.       DATE$(CUR)=LAST_DATE$
  1052.    End If 
  1053.    If(DEF_ENTRIES=3) and(DATE$(CUR)="")
  1054.       DATE$(CUR)="None"
  1055.    End If 
  1056.    LAST_DATE$=DATE$(CUR)
  1057.    '
  1058.    Locate 14,14
  1059.    STRINGGET[DESCR$(CUR),29]
  1060.    DESCR$(CUR)=Param$
  1061.    If(DEF_ENTRIES=2) and(DESCR$(CUR)="")
  1062.       DESCR$(CUR)=LAST_DESCR$
  1063.    End If 
  1064.    If(DEF_ENTRIES=3) and(DESCR$(CUR)="")
  1065.       DESCR$(CUR)="None"
  1066.    End If 
  1067.    LAST_DESCR$=DESCR$(CUR)
  1068.    '
  1069.    If DEBIT#(CUR)=0.0
  1070.       S$=""
  1071.    Else 
  1072.       S$=Right$(Str$(DEBIT#(CUR)),Len(Str$(DEBIT#(CUR)))-1)
  1073.    End If 
  1074.    Locate 45,14
  1075.    STRINGGET[S$,12]
  1076.    D$=Param$
  1077.    DEBIT#(CUR)=Val(D$)
  1078.    If DEBIT#(CUR)<>0.0
  1079.       CREDIT#(CUR)=0.0
  1080.       Pop Proc
  1081.    End If 
  1082.    '
  1083.    If CREDIT#(CUR)=0.0
  1084.       S$=""
  1085.    Else 
  1086.       S$=Right$(Str$(CREDIT#(CUR)),Len(Str$(CREDIT#(CUR)))-1)
  1087.    End If 
  1088.    Locate 59,14
  1089.    STRINGGET[S$,12]
  1090.    D$=Param$
  1091.    CREDIT#(CUR)=Val(D$)
  1092. End Proc
  1093. '
  1094. '
  1095. ' the following procs cover the third column of menu options - REPORTS   
  1096. Procedure REPORT_ACCT
  1097.    Reserve Zone 
  1098.    Reserve Zone 6
  1099.    Cls : H0MEY=False
  1100.    _REFRESHSCREEN:
  1101.    Do 
  1102.       Multi Wait 
  1103.       If Not H0MEY
  1104.          Cls 
  1105.          Locate ,5
  1106.          Centre(Border$("Report An Account",1))
  1107.          Locate ,8
  1108.          Inverse On : Centre(Zone$("Output Transactions?",1)) : Print : Inverse Off 
  1109.          If R_OT
  1110.             Centre "Yes" : Print 
  1111.          Else 
  1112.             Centre "No" : Print 
  1113.          End If 
  1114.          Inverse On : Centre(Zone$("Output Balance?",2)) : Print : Inverse Off 
  1115.          If R_OBA
  1116.             Centre "Yes" : Print 
  1117.          Else 
  1118.             Centre "No" : Print 
  1119.          End If 
  1120.          Inverse On : Centre(Zone$("Output Any Budget Info?",3)) : Print : Inverse Off 
  1121.          If R_OBU
  1122.             Centre "Yes" : Print 
  1123.          Else 
  1124.             Centre "No" : Print 
  1125.          End If 
  1126.          Inverse On : Centre(Zone$("Screen or Printer?",4)) : Print : Inverse Off 
  1127.          If R_SP
  1128.             Centre "Screen" : Print 
  1129.          Else 
  1130.             Centre "Printer" : Print : Print 
  1131.          End If 
  1132.          Print : Inverse On : Centre(Zone$("Start",5)) : Print : Inverse Off : Print 
  1133.          Print : Inverse On : Centre(Zone$("QUIT",6)) : Print : Inverse Off 
  1134.       End If 
  1135.       Do 
  1136.          Multi Wait 
  1137.          M=Mouse Zone
  1138.          If Mouse Click
  1139.             If M=1
  1140.                If R_OT
  1141.                   R_OT=False
  1142.                Else 
  1143.                   R_OT=True
  1144.                End If 
  1145.                Locate ,9 : Centre(Space$(3)) : Locate ,9
  1146.                If R_OT
  1147.                   Centre("Yes")
  1148.                Else 
  1149.                   Centre("No")
  1150.                End If 
  1151.             End If 
  1152.             If M=2
  1153.                If R_OBA
  1154.                   R_OBA=False
  1155.                Else 
  1156.                   R_OBA=True
  1157.                End If 
  1158.                Locate ,11 : Centre(Space$(3)) : Locate ,11
  1159.                If R_OBA
  1160.                   Centre("Yes")
  1161.                Else 
  1162.                   Centre("No")
  1163.                End If 
  1164.             End If 
  1165.             If M=3
  1166.                If R_OBU
  1167.                   R_OBU=False
  1168.                Else 
  1169.                   R_OBU=True
  1170.                End If 
  1171.                Locate ,13 : Centre(Space$(3)) : Locate ,13
  1172.                If R_OBU
  1173.                   Centre("Yes")
  1174.                Else 
  1175.                   Centre("No")
  1176.                End If 
  1177.             End If 
  1178.             If M=4
  1179.                If R_SP
  1180.                   R_SP=False
  1181.                Else 
  1182.                   R_SP=True
  1183.                End If 
  1184.                Locate ,15 : Centre(Space$(7)) : Locate ,15
  1185.                If R_SP
  1186.                   Centre("Screen")
  1187.                Else 
  1188.                   Centre("Printer")
  1189.                End If 
  1190.             End If 
  1191.             If M=5
  1192.                ACCT_EDIT_OPEN[""]
  1193.                If Not Param
  1194.                   ACCT$=""
  1195.                   Goto _REFRESHSCREEN
  1196.                End If 
  1197.                REPORT_ACCT_PRINT[False,False]
  1198.                Goto _REFRESHSCREEN
  1199.             End If 
  1200.             If M=6
  1201.                H0MEY=False
  1202.                Exit 2
  1203.             End If 
  1204.          End If 
  1205.       Loop 
  1206.    Loop 
  1207.    H0MEY=False
  1208. End Proc
  1209. Procedure REPORT_ALL
  1210.    Reserve Zone 
  1211.    Reserve Zone 6
  1212.    Cls : H0MEY=False
  1213.    _REFRESHSCREEN:
  1214.    Do 
  1215.       Multi Wait 
  1216.    If BASE$="" Then N0TICE["You need to open a Transaction Base first.",0] : Pop Proc
  1217.       If Not H0MEY
  1218.          Cls 
  1219.          Locate ,5
  1220.          Centre(Border$("Report Current Transaction Base",1))
  1221.          Locate ,8
  1222.          Inverse On : Centre(Zone$("Output Transactions?",1)) : Print : Inverse Off 
  1223.          If R_OT
  1224.             Centre "Yes" : Print 
  1225.          Else 
  1226.             Centre "No" : Print 
  1227.          End If 
  1228.          Inverse On : Centre(Zone$("Output Balance?",2)) : Print : Inverse Off 
  1229.          If R_OBA
  1230.             Centre "Yes" : Print 
  1231.          Else 
  1232.             Centre "No" : Print 
  1233.          End If 
  1234.          Inverse On : Centre(Zone$("Output Any Budget Info?",3)) : Print : Inverse Off 
  1235.          If R_OBU
  1236.             Centre "Yes" : Print 
  1237.          Else 
  1238.             Centre "No" : Print 
  1239.          End If 
  1240.          Inverse On : Centre(Zone$("Screen or Printer?",4)) : Print : Inverse Off 
  1241.          If R_SP
  1242.             Centre "Screen" : Print 
  1243.          Else 
  1244.             Centre "Printer" : Print : Print 
  1245.          End If 
  1246.          Print : Inverse On : Centre(Zone$("Start",5)) : Print : Inverse Off : Print 
  1247.          Print : Inverse On : Centre(Zone$("QUIT",6)) : Print : Inverse Off 
  1248.       End If 
  1249.       Do 
  1250.          Multi Wait 
  1251.          M=Mouse Zone
  1252.          If Mouse Click
  1253.             If M=1
  1254.                If R_OT
  1255.                   R_OT=False
  1256.                Else 
  1257.                   R_OT=True
  1258.                End If 
  1259.                Locate ,9 : Centre(Space$(3)) : Locate ,9
  1260.                If R_OT
  1261.                   Centre("Yes")
  1262.                Else 
  1263.                   Centre("No")
  1264.                End If 
  1265.             End If 
  1266.             If M=2
  1267.                If R_OBA
  1268.                   R_OBA=False
  1269.                Else 
  1270.                   R_OBA=True
  1271.                End If 
  1272.                Locate ,11 : Centre(Space$(3)) : Locate ,11
  1273.                If R_OBA
  1274.                   Centre("Yes")
  1275.                Else 
  1276.                   Centre("No")
  1277.                End If 
  1278.             End If 
  1279.             If M=3
  1280.                If R_OBU
  1281.                   R_OBU=False
  1282.                Else 
  1283.                   R_OBU=True
  1284.                End If 
  1285.                Locate ,13 : Centre(Space$(3)) : Locate ,13
  1286.                If R_OBU
  1287.                   Centre("Yes")
  1288.                Else 
  1289.                   Centre("No")
  1290.                End If 
  1291.             End If 
  1292.             If M=4
  1293.                If R_SP
  1294.                   R_SP=False
  1295.                Else 
  1296.                   R_SP=True
  1297.                End If 
  1298.                Locate ,15 : Centre(Space$(7)) : Locate ,15
  1299.                If R_SP
  1300.                   Centre("Screen")
  1301.                Else 
  1302.                   Centre("Printer")
  1303.                End If 
  1304.             End If 
  1305.             If M=5
  1306.                ALL_BALANCE#=0.0
  1307.                For X=1 To 10
  1308.                   If BASE_ACCT$(X)<>""
  1309.                      ACCT_EDIT_OPEN[BASE_ACCT$(X)]
  1310.                      If Not Param
  1311.                         N0TICE["Account: "+BASE_ACCT$(X)+" not found.",2]
  1312.                         N0TICE["It will not be reported.",2]
  1313.                         Goto _ANOTHERITERATION
  1314.                      End If 
  1315.                      REPORT_ACCT_PRINT[True,False] : Rem all: yes, done: no 
  1316.                   End If 
  1317.                   If X=10
  1318.                      REPORT_ACCT_PRINT[True,True] : Rem all: yes, done: yes
  1319.                   End If 
  1320.                   _ANOTHERITERATION:
  1321.                Next X
  1322.                Goto _REFRESHSCREEN
  1323.             End If 
  1324.             If M=6
  1325.                H0MEY=False
  1326.                Exit 2
  1327.             End If 
  1328.          End If 
  1329.       Loop 
  1330.    Loop 
  1331.    H0MEY=False
  1332. End Proc
  1333. Procedure REPORT_ACCT_PRINT[ALL,_DONE]
  1334.    ' if we're here only for the base balance then go there
  1335.    If _DONE and R_OBA and ALL
  1336.       If R_SP
  1337.          Goto _SHOWBASEBALANCE
  1338.       Else 
  1339.          Goto _PRINTBASEBALANCE
  1340.       End If 
  1341.    End If 
  1342.    ' check our pref and let it have it! 
  1343.    If SORETED and R_OT
  1344.       ACCT_EDIT_SORT
  1345.    End If 
  1346.    ' if printer 
  1347.    If Not R_SP
  1348.       YN["Are you sure you want to send to printer?"]
  1349.       If Param
  1350.          N0TICE["Please make sure your printer is ready.",0]
  1351.          LINNUM=1 : PAGNUM=1 : Rem we're on line 1, page 1
  1352.          ' print out the header 
  1353.          Lprint "Report for ";ACCT$;"  (";TYPE$;")." : Inc LINNUM
  1354.          If Not PAG
  1355.             Lprint : Lprint : LINNUM=LINNUM+2
  1356.          End If 
  1357.          If PAG
  1358.             Lprint "Page: ";PAGNUM : Lprint : Lprint 
  1359.             LINNUM=LINNUM+3
  1360.          End If 
  1361.          If(R_OBA) and(PAGNUM=1)
  1362.             ACCT_EDIT_BALANCE[False]
  1363.             Lprint "   Balance: ";Param$
  1364.             If ALL
  1365.                B#=Val(Param$)
  1366.                If TYPE$="Asset"
  1367.                   ALL_BALANCE#=ALL_BALANCE#+B#
  1368.                Else 
  1369.                   ALL_BALANCE#=ALL_BALANCE#-B#
  1370.                End If 
  1371.             End If 
  1372.             Inc LINNUM
  1373.          End If 
  1374.          If(R_OBU) and(PAGNUM=1)
  1375.             BUDGET_LOAD[False]
  1376.             If Not Param
  1377.                Pop Proc
  1378.             End If 
  1379.             REPORT_ACCT_CALC
  1380.             Lprint : Lprint Space$(3);"Budget Info:" : Lprint 
  1381.             Lprint "Category     Comment                          Debit %  Credit %  Goal %"
  1382.             LINNUM=LINNUM+4
  1383.             For X=1 To 10
  1384.                A$=Str$(CAT_PERCEN_DEB#(X))
  1385.                B$=Str$(CAT_PERCEN_CRED#(X))
  1386.                C$=Str$(GOAL(X))
  1387.                Inc LINNUM
  1388.                Lprint DESCRIPTOR$(X);
  1389.                Y=10-Len(DESCRIPTOR$(X)) : If Y<0 : Y=0 : End If 
  1390.                Lprint Space$(Y+3);
  1391.                Lprint COMMENT$(X);
  1392.                Y=30-Len(COMMENT$(X)) : If Y<0 : Y=0 : End If 
  1393.                Lprint Space$(Y+3);
  1394.                Lprint A$;
  1395.                Y=6-Len(A$) : If Y<0 : Y=0 : End If 
  1396.                Lprint Space$(Y+3);
  1397.                Lprint B$;
  1398.                Y=6-Len(B$) : If Y<0 : Y=0 : End If 
  1399.                Lprint Space$(Y+4);
  1400.                Lprint C$
  1401.             Next X
  1402.             ' go to the next page
  1403.             If PAG
  1404.                For X=LINNUM To LP Step 1
  1405.                   Lprint 
  1406.                Next X
  1407.                Inc PAGNUM : LINNUM=1
  1408.             End If 
  1409.          End If 
  1410.          If R_OT
  1411.             ' we want another page header iff we output transactions and we didn't output one because of the budget report 
  1412.             If(PAG)
  1413.                Lprint "Report for ";ACCT$;"  (";TYPE$;")."
  1414.                Lprint "Page: ";PAGNUM : Lprint : Lprint 
  1415.                LINNUM=LINNUM+4
  1416.             End If 
  1417.             Lprint : Lprint Space$(3);"Transactions:" : Lprint 
  1418.             Lprint "Date       Description                      Debit        Credit"
  1419.             Lprint 
  1420.             LINNUM=LINNUM+4
  1421.             For X=1 To RECNUM
  1422.                If DEBIT#(X)<>0.0
  1423.                   A$=Str$(DEBIT#(X))
  1424.                Else 
  1425.                   A$=""
  1426.                End If 
  1427.                If CREDIT#(X)<>0.0
  1428.                   B$=Str$(CREDIT#(X))
  1429.                Else 
  1430.                   B$=""
  1431.                End If 
  1432.                Lprint Using "~~~~~~~~   ";DATE$(X);
  1433.                Lprint Using "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ";DESCR$(X);
  1434.                Lprint Using "~~~~~~~~~~   ";A$;
  1435.                Lprint Using "~~~~~~~~~~";B$
  1436.                Inc LINNUM
  1437.                ' don't want this unless we had to do the transactions too 
  1438.                If(PAG)
  1439.                   If(LINNUM=LP) or(X=RECNUM)
  1440.                      If X=RECNUM
  1441.                         For Y=LINNUM To LP
  1442.                            Lprint 
  1443.                         Next Y
  1444.                         Pop Proc
  1445.                      End If 
  1446.                      'if linnum = lp
  1447.                      LINNUM=1 : Inc PAGNUM
  1448.                      Lprint "Report for ";ACCT$;"  (";TYPE$;")."
  1449.                      Lprint "Page: ";PAGNUM : Lprint : Lprint 
  1450.                      LINNUM=LINNUM+4
  1451.                   End If 
  1452.                Next X
  1453.             End If 
  1454.          End If 
  1455.          Goto _NEXT
  1456.          _PRINTBASEBALANCE:
  1457.          'output balance page after finishing off the last page 
  1458.          For X=LINNUM To LP
  1459.             Lprint 
  1460.          Next X
  1461.          LINNUM=1 : Lprint 
  1462.          A$=Str$(ALL_BALANCE#)
  1463.          Lprint "Calculated worth of ";BASE$;":";A$
  1464.       End If 
  1465.       H0MEY=False
  1466.    End If 
  1467.    _NEXT:
  1468.    ' if screen
  1469.    If R_SP
  1470.       Cls 
  1471.       LINNUM=1 : PAGNUM=1 : Rem we're on line 1, page 1
  1472.       Print "Report for ";ACCT$;"  (";TYPE$;")." : Inc LINNUM
  1473.       If Not PAG
  1474.          Print : Print : LINNUM=LINNUM+2
  1475.       End If 
  1476.       If PAG
  1477.          Print "Page: ";PAGNUM : Print : Print 
  1478.          LINNUM=LINNUM+3
  1479.       End If 
  1480.       If(R_OBA) and(PAGNUM=1)
  1481.          ACCT_EDIT_BALANCE[False]
  1482.          Print "   Balance: ";Param$
  1483.          If ALL
  1484.             B#=Val(Param$)
  1485.             If TYPE$="Asset"
  1486.                ALL_BALANCE#=ALL_BALANCE#+B#
  1487.             Else 
  1488.                ALL_BALANCE#=ALL_BALANCE#-B#
  1489.             End If 
  1490.          End If 
  1491.          Inc LINNUM
  1492.       End If 
  1493.       If(R_OBU) and(PAGNUM=1)
  1494.          BUDGET_LOAD[False]
  1495.          If Not Param
  1496.             Pop Proc
  1497.          End If 
  1498.          REPORT_ACCT_CALC
  1499.          Print : Print Space$(3);"Budget Info:" : Print 
  1500.          Print "Category     Comment                          Debit %  Credit %  Goal %"
  1501.          LINNUM=LINNUM+4
  1502.          For X=1 To 10
  1503.             A$=Str$(CAT_PERCEN_DEB#(X))
  1504.             B$=Str$(CAT_PERCEN_CRED#(X))
  1505.             C$=Str$(GOAL(X))
  1506.             Inc LINNUM
  1507.             Print DESCRIPTOR$(X);
  1508.             Y=10-Len(DESCRIPTOR$(X)) : If Y<0 : Y=0 : End If 
  1509.             Print Space$(Y+3);
  1510.             Print COMMENT$(X);
  1511.             Y=30-Len(COMMENT$(X)) : If Y<0 : Y=0 : End If 
  1512.             Print Space$(Y+3);
  1513.             Print A$;
  1514.             Y=6-Len(A$) : If Y<0 : Y=0 : End If 
  1515.             Print Space$(Y+3);
  1516.             Print B$;
  1517.             Y=6-Len(B$) : If Y<0 : Y=0 : End If 
  1518.             Print Space$(Y+4);
  1519.             Print C$
  1520.          Next X
  1521.          ' go to the next page
  1522.          If PAG
  1523.             For X=LINNUM To 22 Step 1
  1524.                Print 
  1525.             Next X
  1526.             Inc PAGNUM : LINNUM=1
  1527.          End If 
  1528.       End If 
  1529.       ' we'll want a page break in any case after the budget report
  1530.       CONTINUE
  1531.       If Not R_OBU
  1532.          Inc PAGNUM
  1533.       End If 
  1534.       If(R_OT)
  1535.          Print "Report for ";ACCT$;"  (";TYPE$;")."
  1536.          Print "Page: ";PAGNUM : Print : Print 
  1537.          LINNUM=LINNUM+4
  1538.          Print : Print Space$(3);"Transactions:" : Print 
  1539.          Print "Date       Description                      Debit        Credit"
  1540.          Print 
  1541.          LINNUM=LINNUM+5
  1542.          For X=1 To RECNUM
  1543.             If DEBIT#(X)<>0.0
  1544.                A$=Str$(DEBIT#(X))
  1545.             Else 
  1546.                A$=""
  1547.             End If 
  1548.             If CREDIT#(X)<>0.0
  1549.                B$=Str$(CREDIT#(X))
  1550.             Else B$=""
  1551.             End If 
  1552.             Print Using "~~~~~~~~   ";DATE$(X);
  1553.             Print Using "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ";DESCR$(X);
  1554.             Print Using "~~~~~~~~~~   ";A$;
  1555.             Print Using "~~~~~~~~~~";B$
  1556.             Inc LINNUM
  1557.             ' don't want this unless we had to do the transactions too 
  1558.             If(PAG)
  1559.                If(LINNUM=22) or(X=RECNUM)
  1560.                   CONTINUE
  1561.                   If X=RECNUM
  1562.                      Pop Proc
  1563.                   End If 
  1564.                   LINNUM=1 : Inc PAGNUM
  1565.                   Print "Report for ";ACCT$;"  (";TYPE$;")."
  1566.                   Print "Page: ";PAGNUM : Print : Print 
  1567.                   LINNUM=LINNUM+4
  1568.                End If 
  1569.             Next X
  1570.          End If 
  1571.       End If 
  1572.       Goto _ENDING
  1573.       _SHOWBASEBALANCE:
  1574.       'output balance page after finishing off the last page 
  1575.       Cls 
  1576.       LINNUM=1 : Print 
  1577.       A$=Str$(ALL_BALANCE#)
  1578.       Print "Calculated worth of ";BASE$;":";A$
  1579.       CONTINUE
  1580.    End If 
  1581.    _ENDING:
  1582. End Proc
  1583. Procedure REPORT_ACCT_CALC
  1584.    ' This requires that the account file and budget files are already open  
  1585.    '  for input then it performs the following 3 functions using nested loops 
  1586.    ' This proc is used to calculate one account's figures.  The Report_All proc 
  1587.    '  will need to use this proc in a loop to allow it success. 
  1588.    ' 1. get totals of credits and debits for the account  
  1589.    ' 2. get totals of credits and debits for each descriptor listed in the budget which appears in the account
  1590.    ' 3. compute %'s - = descriptor total/total for the account
  1591.    ' making sure we get clean results 
  1592.    BAL_TOTALS_DEB#=0 : BAL_TOTALS_CRED#=0
  1593.    For Y=1 To 10
  1594.       CAT_TOTALS_DEB#(Y)=0 : CAT_TOTALS_CRED#(Y)=0
  1595.    Next Y
  1596.    For X=1 To RECNUM
  1597.       BAL_TOTALS_DEB#=BAL_TOTALS_DEB#+DEBIT#(X)
  1598.       BAL_TOTALS_CRED#=BAL_TOTALS_CRED#+CREDIT#(X)
  1599.       For Y=1 To 10
  1600.          If DESCR$(X)=DESCRIPTOR$(Y)
  1601.             CAT_TOTALS_DEB#(Y)=CAT_TOTALS_DEB#(Y)+DEBIT#(X)
  1602.             CAT_TOTALS_CRED#(Y)=CAT_TOTALS_CRED#(Y)+CREDIT#(X)
  1603.          End If 
  1604.       Next Y
  1605.    Next X
  1606.    For X=1 To 10 Step 1
  1607.       ' prevent division by zero 
  1608.       If BAL_TOTALS_DEB#>0
  1609.          CAT_PERCEN_DEB#(X)=0
  1610.          CAT_PERCEN_DEB#(X)=(CAT_TOTALS_DEB#(X)/BAL_TOTALS_DEB#)*100
  1611.       Else 
  1612.          CAT_PERCEN_DEB#(X)=0
  1613.       End If 
  1614.       If BAL_TOTALS_CRED#>0
  1615.          CAT_PERCEN_CRED#(X)=0
  1616.          CAT_PERCEN_CRED#(X)=(CAT_TOTALS_CRED#(X)/BAL_TOTALS_CRED#)*100
  1617.       Else 
  1618.          CAT_PERCEN_CRED#(X)=0
  1619.       End If 
  1620.    Next X
  1621. End Proc
  1622. '
  1623. ' the following procs cover the use of budgets 
  1624. Procedure BUDGET
  1625.    Cls : H0MEY=False : Rem for our purposes, will reset later 
  1626.    Reserve Zone 
  1627.    Reserve Zone 13
  1628.    ' need to blank this out so the last session doesn't stick around
  1629.    For X=1 To 10
  1630.       DESCRIPTOR$(X)="" : COMMENT$(X)="" : GOAL(X)=0
  1631.    Next X
  1632.    BUDGET_LOAD[True]
  1633.    If BGT$="" Then Pop Proc : Rem we require a name to get into here 
  1634.    _REFRESHSCREEN:
  1635.    If Not H0MEY
  1636.       Cls 
  1637.       Locate ,2
  1638.       Centre(Border$("Account Budgeting Screen",1))
  1639.       Under On 
  1640.       Locate 3,5 : Print "Descriptor"
  1641.       Locate 22,5 : Print "Comment"
  1642.       Locate 55,5 : Print "Goal %"
  1643.       Under Off 
  1644.       For Y=1 To 10
  1645.          Locate 1,Y+7 : Print Zone$(Chr$(176)+" "+DESCRIPTOR$(Y)+Space$(10-Len(DESCRIPTOR$(Y))),Y)
  1646.          '         Locate 3,Y+7 : Print DESCRIPTOR$(Y)
  1647.          Locate 22,Y+7 : Print COMMENT$(Y)
  1648.          Locate 55,Y+7
  1649.          If GOAL(Y)<>0
  1650.             S$=Right$(Str$(GOAL(Y)),Len(Str$(GOAL(Y)))-1)
  1651.             Print S$
  1652.          End If 
  1653.       Next Y
  1654.       Locate 15,20 : Print Border$(Zone$("SAVE",11),1)
  1655.       Locate 35,20 : Print Border$(Zone$("LOAD",12),1)
  1656.       Locate 55,20 : Print Border$(Zone$("QUIT",13),1)
  1657.       H0MEY=True
  1658.    End If 
  1659.    Do 
  1660.       Multi Wait 
  1661.       If Not H0MEY
  1662.          Goto _REFRESHSCREEN
  1663.       End If 
  1664.       M=Mouse Zone
  1665.       If Mouse Click
  1666.          If(M=>1) and(M<=10)
  1667.             Locate 3,7+M
  1668.             STRINGGET[DESCRIPTOR$(M),10]
  1669.             DESCRIPTOR$(M)=Param$
  1670.             Locate 22,7+M
  1671.             STRINGGET[COMMENT$(M),30]
  1672.             COMMENT$(M)=Param$
  1673.             A:
  1674.             Locate 55,7+M
  1675.             If GOAL(M)=0
  1676.                S$=""
  1677.             Else 
  1678.                ' we only want the number, we exclude the preceding space
  1679.                S$=Right$(Str$(GOAL(M)),Len(Str$(GOAL(M)))-1)
  1680.             End If 
  1681.             STRINGGET[S$,3]
  1682.             S$=Param$
  1683.             GOAL(M)=Val(S$)
  1684.             If(GOAL(M)<0) or(GOAL(M)>100)
  1685.                Goto A
  1686.             End If 
  1687.             H0MEY=False
  1688.          End If 
  1689.          If M=11
  1690.             BUDGET_SAVE
  1691.             H0MEY=False
  1692.          End If 
  1693.          If M=12
  1694.             BUDGET_LOAD[True]
  1695.             H0MEY=False
  1696.          End If 
  1697.          If M=13
  1698.             YN["Would you like to save your work first?"]
  1699.             If Param
  1700.                BUDGET_SAVE
  1701.             End If 
  1702.             Exit 
  1703.          End If 
  1704.       End If 
  1705.    Loop 
  1706.    Reserve Zone : H0MEY=False
  1707. End Proc
  1708. Procedure BUDGET_SAVE
  1709.    Clear Key : H0MEY=False
  1710.    N0TICE["Saving your Budget file.",1]
  1711.    Open Out 1,BGT$
  1712.    Print #1,(PROG$+" Budget")
  1713.    Print #1,VER$
  1714.    For X=1 To 10
  1715.       Print #1,DESCRIPTOR$(X)
  1716.       Print #1,COMMENT$(X)
  1717.       Print #1,GOAL(X)
  1718.    Next X
  1719.    Close 1
  1720. End Proc
  1721. Procedure BUDGET_LOAD[ALLL]
  1722.    RET=True : Rem by default the proc is successfull, unless somthing goes wrong 
  1723.    Clear Key 
  1724.    B$=Fsel$(BASEDIR$,"","Choose Budget.","")
  1725.    If B$=""
  1726.       RET=False : Goto _ENDING
  1727.    End If 
  1728.    If ALLL
  1729.       If Not Exist(B$)
  1730.          N0TICE["That budget file does not exist.",0]
  1731.          YN["Would you like me to create it for you?"]
  1732.          If Param
  1733.             BGT$=B$
  1734.             BUDGET_SAVE
  1735.          Else 
  1736.             H0MEY=False
  1737.             RET=False : Goto _ENDING
  1738.          End If 
  1739.       End If 
  1740.    End If 
  1741.    If Not Exist(B$)
  1742.       N0TICE["That file does not exist",0]
  1743.       RET=False : Goto _ENDING
  1744.    End If 
  1745.    BGT$=B$ : Rem now that we know it's valid we can save it to our global 
  1746.    Open In 1,BGT$
  1747.    Line Input #1,CK$
  1748.    If CK$<>(PROG$+" Budget")
  1749.       N0TICE["This is not a Budget file.",0]
  1750.       BGT$=""
  1751.       Close 1
  1752.       RET=False : Goto _ENDING
  1753.    End If 
  1754.    Line Input #1,V$ : Rem version ignored for now
  1755.    For X=1 To 10
  1756.       Line Input #1,DESCRIPTOR$(X)
  1757.       Line Input #1,COMMENT$(X)
  1758.       Line Input #1,GOAL(X)
  1759.    Next X
  1760.    Close 1
  1761.    _ENDING:
  1762.    H0MEY=False
  1763. End Proc[RET]
  1764. '
  1765. 'the following procs cover the last column of menu options - PREFS 
  1766. Procedure PREFS_COLORS
  1767.    'first we need to obtain the values of the current palette 
  1768.    Cls 
  1769.    Print : Centre(Border$("Color Prefs Screen",1))
  1770.    Locate 1,4 : Centre(Border$("Red     Green    Blue",1))
  1771.    Shade On 
  1772.    Inverse On : Locate 1,8 : Centre("Background Color") : Inverse Off 
  1773.    Pen 1 : Locate 1,12 : Centre("Regular Color")
  1774.    Pen 2 : Locate 1,16 : Centre("Highlight Color")
  1775.    Pen 3 : Locate 1,20 : Centre("Menu Color")
  1776.    Pen 1
  1777.    Shade Off 
  1778.    Reserve Zone 25
  1779.    ' background color 
  1780.    Locate 31,7 : Print Zone$("+",1)
  1781.    Locate 39,7 : Print Zone$("+",2)
  1782.    Locate 48,7 : Print Zone$("+",3)
  1783.    Locate 31,9 : Print Zone$("-",4)
  1784.    Locate 39,9 : Print Zone$("-",5)
  1785.    Locate 48,9 : Print Zone$("-",6)
  1786.    ' regular text color 
  1787.    Locate 31,11 : Print Zone$("+",7)
  1788.    Locate 39,11 : Print Zone$("+",8)
  1789.    Locate 48,11 : Print Zone$("+",9)
  1790.    Locate 31,13 : Print Zone$("-",10)
  1791.    Locate 39,13 : Print Zone$("-",11)
  1792.    Locate 48,13 : Print Zone$("-",12)
  1793.    'highlighted text color
  1794.    Locate 31,15 : Print Zone$("+",13)
  1795.    Locate 39,15 : Print Zone$("+",14)
  1796.    Locate 48,15 : Print Zone$("+",15)
  1797.    Locate 31,17 : Print Zone$("-",16)
  1798.    Locate 39,17 : Print Zone$("-",17)
  1799.    Locate 48,17 : Print Zone$("-",18)
  1800.    'menu text color 
  1801.    Locate 31,19 : Print Zone$("+",19)
  1802.    Locate 39,19 : Print Zone$("+",20)
  1803.    Locate 48,19 : Print Zone$("+",21)
  1804.    Locate 31,21 : Print Zone$("-",22)
  1805.    Locate 39,21 : Print Zone$("-",23)
  1806.    Locate 48,21 : Print Zone$("-",24)
  1807.    '
  1808.    Data 31,49,7,10,11,14,15,18,19,22
  1809.    Read X1,X2
  1810.    X1=X Graphic(X1) : X2=X Graphic(X2)
  1811.    Ink 1
  1812.    For N=1 To 4
  1813.       Read Y1,Y2
  1814.       Y1=Y Graphic(Y1) : Y2=Y Graphic(Y2)
  1815.       If N>1
  1816.          Ink N-1
  1817.       End If 
  1818.       Box X1,Y1 To X2,Y2
  1819.    Next N
  1820.    Locate 10,12 : Print Zone$(Border$("Quit",1),25)
  1821.    Do 
  1822.       Multi Wait 
  1823.       M=Mouse Zone
  1824.       If Mouse Key=1
  1825.          If M=1
  1826.             If B1<15
  1827.                B1=B1+1
  1828.             End If 
  1829.          End If 
  1830.          If M=2
  1831.             If B2<15
  1832.                B2=B2+1
  1833.             End If 
  1834.          End If 
  1835.          If M=3
  1836.             If B3<15
  1837.                B3=B3+1
  1838.             End If 
  1839.          End If 
  1840.          If M=4
  1841.             If B1>0
  1842.                B1=B1-1
  1843.             End If 
  1844.          End If 
  1845.          If M=5
  1846.             If B2>0
  1847.                B2=B2-1
  1848.             End If 
  1849.          End If 
  1850.          If M=6
  1851.             If B3>0
  1852.                B3=B3-1
  1853.             End If 
  1854.          End If 
  1855.          If M=7
  1856.             If R1<15
  1857.                R1=R1+1
  1858.             End If 
  1859.          End If 
  1860.          If M=8
  1861.             If R2<15
  1862.                R2=R2+1
  1863.             End If 
  1864.          End If 
  1865.          If M=9
  1866.             If R3<15
  1867.                R3=R3+1
  1868.             End If 
  1869.          End If 
  1870.          If M=10
  1871.             If R1>0
  1872.                R1=R1-1
  1873.             End If 
  1874.          End If 
  1875.          If M=11
  1876.             If R2>0
  1877.                R2=R2-1
  1878.             End If 
  1879.          End If 
  1880.          If M=12
  1881.             If R3>0
  1882.                R3=R3-1
  1883.             End If 
  1884.          End If 
  1885.          If M=13
  1886.             If H1<15
  1887.                H1=H1+1
  1888.             End If 
  1889.          End If 
  1890.          If M=14
  1891.             If H2<15
  1892.                H2=H2+1
  1893.             End If 
  1894.          End If 
  1895.          If M=15
  1896.             If H3<15
  1897.                H3=H3+1
  1898.             End If 
  1899.          End If 
  1900.          If M=16
  1901.             If H1>0
  1902.                H1=H1-1
  1903.             End If 
  1904.          End If 
  1905.          If M=17
  1906.             If H2>0
  1907.                H2=H2-1
  1908.             End If 
  1909.          End If 
  1910.          If M=18
  1911.             If H3>0
  1912.                H3=H3-1
  1913.             End If 
  1914.          End If 
  1915.          If M=19
  1916.             If M1<15
  1917.                M1=M1+1
  1918.             End If 
  1919.          End If 
  1920.          If M=20
  1921.             If M2<15
  1922.                M2=M2+1
  1923.             End If 
  1924.          End If 
  1925.          If M=21
  1926.             If M3<15
  1927.                M3=M3+1
  1928.             End If 
  1929.          End If 
  1930.          If M=22
  1931.             If M1>0
  1932.                M1=M1-1
  1933.             End If 
  1934.          End If 
  1935.          If M=23
  1936.             If M2>0
  1937.                M2=M2-1
  1938.             End If 
  1939.          End If 
  1940.          If M=24
  1941.             If M3>0
  1942.                M3=M3-1
  1943.             End If 
  1944.          End If 
  1945.          If M=25
  1946.             Exit 
  1947.          End If 
  1948.       End If 
  1949.       B0=((B1*256)+(B2*16)+B3)
  1950.       R0=((R1*256)+(R2*16)+R3)
  1951.       H0=((H1*256)+(H2*16)+H3)
  1952.       M0=((M1*256)+(M2*16)+M3)
  1953.       Palette B0,R0,H0,M0
  1954.       Wait 10
  1955.    Loop 
  1956.    H0MEY=False
  1957.    Reserve Zone 
  1958. End Proc
  1959. Procedure PREFS_PRINTER
  1960.    Reserve Zone 
  1961.    Reserve Zone 3
  1962.    Cls 
  1963.    _REFRESHSCREEN:
  1964.    Do 
  1965.       Multi Wait 
  1966.       Cls 
  1967.       Locate ,5
  1968.       Centre(Border$("Printer Preferences",1))
  1969.       Locate ,10
  1970.       Inverse On : Centre(Zone$("Lines per page:",1)) : Print : Inverse Off 
  1971.       Locate 37,11 : Print LP
  1972.       Inverse On : Centre(Zone$("Paginate?",2)) : Print : Inverse Off 
  1973.       If PAG Then Centre "Yes" : Print 
  1974.       If Not PAG Then Centre "No" : Print 
  1975.       Print : Inverse On : Centre(Zone$("QUIT",3)) : Print : Inverse Off 
  1976.       Do 
  1977.          Multi Wait 
  1978.          M=Mouse Zone
  1979.          If Mouse Click
  1980.             If M=1
  1981.                A:
  1982.                Locate 36,11 : Print "              " : Locate 37,11
  1983.                Clear Key 
  1984.                Input " ";LP
  1985.                If LP<20
  1986.                   Goto A
  1987.                End If 
  1988.                Curs Off : Goto _REFRESHSCREEN
  1989.             End If 
  1990.             If M=2
  1991.                Locate 36,13 : Print Space$(3)
  1992.                ' first we switch the current value then we output it
  1993.                If PAG
  1994.                   PAG=False
  1995.                Else 
  1996.                   PAG=True
  1997.                End If 
  1998.                If PAG
  1999.                   Locate 38,13 : Print Space$(3) : Locate 38,13 : Print "Yes"
  2000.                Else 
  2001.                   Locate 38,13 : Print Space$(3) : Locate 38,13 : Print "No"
  2002.                End If 
  2003.             End If 
  2004.             If M=3
  2005.                H0MEY=False
  2006.                Exit 2
  2007.             End If 
  2008.          End If 
  2009.       Loop 
  2010.    Loop 
  2011.    H0MEY=False
  2012. End Proc
  2013. Procedure PREFS_SORTING
  2014.    H0MEY=False
  2015.    YN["Do you want your Accounts sorted before saving/printing?"]
  2016.    If Param
  2017.       SORETED=True
  2018.    Else 
  2019.       SORETED=False
  2020.    End If 
  2021. End Proc
  2022. Procedure PREFS_MAXENTRIES
  2023.    H0MEY=False
  2024.    A: Cls 
  2025.    Locate ,5
  2026.    Centre(Border$("Maximum Number of Entries Preference",1))
  2027.    Locate ,10
  2028.    Centre("What is the max # of entries you think you will use in an acct?") : Print 
  2029.    A$=Str$(MXENTRIES)
  2030.    Centre("Currently "+A$+" is your preference.") : Print : Print 
  2031.    Locate 36, : Clear Key : Input "";M
  2032.    If M=0 Then M=MXENTRIES : Pop Proc : Rem get out if no change 
  2033.    If M<1 Then Goto A : Rem preventing possible logic error in i/o 
  2034.    If M>1000 Then N0TICE["This version has a limit of 1000 records.",0] : Goto A
  2035.    N0TICE["You need to save your prefs file and restart to make this pref work.",0]
  2036.    MXENTRIES=M : Rem make it global now that it's ok. 
  2037. End Proc
  2038. Procedure PREFS_DEF_VALUES
  2039.    Reserve Zone 
  2040.    Reserve Zone 3
  2041.    Cls 
  2042.    _REFRESHSCREEN:
  2043.    Do 
  2044.       Multi Wait 
  2045.       Cls 
  2046.       H0MEY=False
  2047.       Locate ,5
  2048.       Centre(Border$("Default Entries Preference",1)) : Print : Print : Print 
  2049.       Centre("Within the Account Editor, when text is prompted for and you give a") : Print 
  2050.       Centre("blank answer you want the default answer to be:") : Print 
  2051.       Locate ,12
  2052.       Inverse On : Centre(Zone$("Blank",1)) : Print : Print 
  2053.       Centre(Zone$("Last Value Entered",2)) : Print : Print 
  2054.       Centre(Zone$("`None'",3)) : Inverse Off : Print : Print 
  2055.       Do 
  2056.          Multi Wait 
  2057.          M=Mouse Zone
  2058.          If Mouse Click
  2059.             If M=1
  2060.                DEF_ENTRIES=1 : Pop Proc
  2061.             End If 
  2062.             If M=2
  2063.                DEF_ENTRIES=2 : Pop Proc
  2064.             End If 
  2065.             If M=3
  2066.                DEF_ENTRIES=3 : Pop Proc
  2067.             End If 
  2068.          End If 
  2069.       Loop 
  2070.    Loop 
  2071. End Proc
  2072. Procedure PREFS_MOUSE
  2073.    Reserve Zone 
  2074.    Reserve Zone 4
  2075.    Cls 
  2076.    _REFRESHSCREEN:
  2077.    Do 
  2078.       Multi Wait 
  2079.       A:
  2080.       Cls 
  2081.       H0MEY=False
  2082.       Locate ,5
  2083.       Centre(Border$("Mouse Pointer Preference",1)) : Print : Print : Print 
  2084.       Locate ,12
  2085.       Inverse On : Centre(Zone$("Arrow",1)) : Print : Print 
  2086.       Centre(Zone$("Crosshairs",2)) : Print : Print 
  2087.       Centre(Zone$("System Pointer",3)) : Print : Print 
  2088.       Centre(Zone$("QUIT",4)) : Print : Print : Inverse Off 
  2089.       Do 
  2090.          Multi Wait 
  2091.          M=Mouse Zone
  2092.          If Mouse Click
  2093.             If M=1
  2094.                _MOUSE=1 : Change Mouse _MOUSE
  2095.             End If 
  2096.             If M=2
  2097.                _MOUSE=2 : Change Mouse _MOUSE
  2098.             End If 
  2099.             If M=3
  2100.                _GET_SYS_MOUSE
  2101.                ' don't change our global if the change was not successful 
  2102.                If Param
  2103.                   _MOUSE=3
  2104.                Else 
  2105.                   Goto A : Rem if not param then it failed and screen needs refreshing
  2106.                End If 
  2107.             End If 
  2108.             If M=4
  2109.                Pop Proc
  2110.             End If 
  2111.          End If 
  2112.       Loop 
  2113.    Loop 
  2114. End Proc
  2115. Procedure PREFS_LOAD[IN$]
  2116.    Clear Key 
  2117.    If IN$="" Then IN$=Fsel$("","","Choose prefs file to load")
  2118.    If(IN$<>"")
  2119.       If Exist(IN$)
  2120.          Open In 1,IN$
  2121.          Line Input #1,A$
  2122.          If A$<>(PROG$+" Prefs")
  2123.             N0TICE["File not a Home Accountant prefs file.",0] : PREFS_DEFAULT
  2124.          Else 
  2125.             ' this inputs the null colors too
  2126.             Line Input #1,VER$,B1,B2,B3,R1,R2,R3,H1,H2,H3,M1,M2,M3,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,Z,LP,PAG,FF,SORETED,MXENTRIES,DEF_ENTRIES,_MOUSE
  2127.          End If 
  2128.          Close 1
  2129.       End If 
  2130.    End If 
  2131.    Palette((B1*256)+(B2*16)+B3),((R1*256)+(R2*16)+R3),((H1*256)+(H2*16)+H3),((M1*256)+(M2*16)+M3) : Cls 
  2132.    If _MOUSE<3 Then Change Mouse _MOUSE
  2133.    If _MOUSE=3 Then _GET_SYS_MOUSE
  2134.    H0MEY=False
  2135. End Proc
  2136. Procedure PREFS_SAVE
  2137.    Clear Key 
  2138.    OUT$=Fsel$("s:","HomeAccountant.Prefs","Chooose prefs file to save")
  2139.    If(OUT$="")
  2140.       Pop Proc
  2141.    Else 
  2142.       If Not(Exist(OUT$))
  2143.          A:
  2144.          Open Out 1,OUT$
  2145.          Print #1,PROG$+" Prefs"
  2146.          Print #1,VER$
  2147.          Print #1,B1
  2148.          Print #1,B2
  2149.          Print #1,B3
  2150.          Print #1,R1
  2151.          Print #1,R2
  2152.          Print #1,R3
  2153.          Print #1,H1
  2154.          Print #1,H2
  2155.          Print #1,H3
  2156.          Print #1,M1
  2157.          Print #1,M2
  2158.          Print #1,M3
  2159.          ' here's our null colors for when we go to an 8 color screen 
  2160.          Print #1,0
  2161.          Print #1,0
  2162.          Print #1,0
  2163.          Print #1,0
  2164.          Print #1,0
  2165.          Print #1,0
  2166.          Print #1,0
  2167.          Print #1,0
  2168.          Print #1,0
  2169.          Print #1,0
  2170.          Print #1,0
  2171.          Print #1,0
  2172.          Print #1,LP
  2173.          Print #1,PAG
  2174.          Print #1,FF
  2175.          Print #1,SORETED
  2176.          Print #1,MXENTRIES
  2177.          Print #1,DEF_ENTRIES
  2178.          Print #1,_MOUSE
  2179.          Close 1
  2180.       Else 
  2181.          N0TICE["File: "+OUT$+" already exists.",0]
  2182.          YN["Want to overwrite it?"]
  2183.          If Param
  2184.             Goto A
  2185.          End If 
  2186.       End If 
  2187.    End If 
  2188. End Proc
  2189. Procedure PREFS_DEFAULT
  2190.    Cls 
  2191.    Colour Back Colour(0)
  2192.    B1=0 : B2=0 : B3=0 : Rem black
  2193.    R1=15 : R2=0 : R3=15 : Rem purple 
  2194.    H1=0 : H2=15 : H3=0 : Rem bright green 
  2195.    M1=14 : M2=0 : M3=10 : Rem hot/deep pink  
  2196.    Palette((B1*256)+(B2*16)+B3),((R1*256)+(R2*16)+R3),((H1*256)+(H2*16)+H3),((M1*256)+(M2*16)+M3) : Cls 
  2197.    LP=66 : PAG=True : FF=True : DATEFORM$="MM/DD/YY" : SORETED=False
  2198.    MXENTRIES=500 : Rem maximum number of entries per acct 
  2199.    DEF_ENTRIES=1 : _MOUSE=1 : Change Mouse _MOUSE
  2200.    H0MEY=False
  2201. End Proc
  2202. '
  2203. '
  2204. ' these last procs are called by the above three sections of procs 
  2205. ' - g_name gives you the actual file/path name given a full pathname+file  
  2206. ' - n0tice gives feedback to the user about what is happening (e.g. errors, disk access, etc.) 
  2207. ' - yn asks a yes/no question and returns the result 
  2208. ' - stringget gets a string given prev_value,mxchar's  
  2209. ' - continue simply is used to pause the screen to let the user look b4 it cls's 
  2210. ' - _get_sys_mouse attempts to grab your system mouse shape and palette
  2211. Procedure G_NAME[NAME$,T$]
  2212.    ' this function is for extracting the actual file name out of a path 
  2213.    '   used for referring to the accts that are path listed in the .BASE file 
  2214.    '
  2215.    A=Len(NAME$)
  2216.    While((Mid$(NAME$,A,1)<>"/") and(Mid$(NAME$,A,1)<>":")) and(A<>0)
  2217.       Dec A
  2218.    Wend 
  2219.    If T$="file" Then RET$=Right$(NAME$,Len(NAME$)-A)
  2220.    If T$="path" Then RET$=Left$(NAME$,A)
  2221. End Proc[RET$]
  2222. Procedure N0TICE[MSG$,T]
  2223.    ' t = ?
  2224.    '     0 : wait for keypress or mouse click 
  2225.    '     1 : just show the message and leave
  2226.    '     2 : wait for 2 seconds and leave 
  2227.    Curs Off : Clear Key : Bell : Cls : Locate ,10 : Pen 2 : Centre MSG$ : Pen 1
  2228.    If T=0
  2229.       Print : Print : Centre "Press a key or mouse button to continue."
  2230.    End If 
  2231.    H0MEY=False
  2232.    MOUSY=0
  2233.    If T=0
  2234.       Do 
  2235.          Multi Wait 
  2236.          MOUSY=Mouse Click
  2237.          If MOUSY<>0
  2238.             Cls : Pop Proc
  2239.          End If 
  2240.          SURE$=Inkey$
  2241.          If SURE$<>""
  2242.             Cls : Pop Proc
  2243.          End If 
  2244.       Loop 
  2245.    End If 
  2246.    If T=2
  2247.       Wait(100)
  2248.    End If 
  2249. End Proc
  2250. Procedure YN[QUESTION$]
  2251.    H0MEY=False
  2252.    Clear Key : SURE$="" : SURE=False : Rem defaults 
  2253.    Cls : Locate ,10 : Pen 2 : Centre QUESTION$
  2254.    Pen 1 : Print : Centre "(Y/N) or (LMB/RMB)"
  2255.    A:
  2256.    MOUSY=0
  2257.    Do 
  2258.       Multi Wait 
  2259.       MOUSY=Mouse Click : If MOUSY<>0 Then Exit 
  2260.       SURE$=Inkey$ : If SURE$<>"" Then Exit 
  2261.    Loop 
  2262.    If MOUSY=1 Then SURE=True
  2263.    If MOUSY=2 Then SURE=False
  2264.    If(SURE$<>"") and(Lower$(Left$(SURE$,1))="y") Then SURE=True
  2265.    Cls 
  2266. End Proc[SURE]
  2267. Procedure STRINGGET[OBJ$,MXCHAR]
  2268. ' this will input obj$ for a max of 31 chars 
  2269.    Memorize X 
  2270.    Memorize Y 
  2271.    Clear Key 
  2272.    Curs On 
  2273.    'idiot proofing
  2274.    If(Len(OBJ$)>MXCHAR) or(Len(OBJ$)>31)
  2275.       OBJ$=Left$(OBJ$,Min(31,MXCHAR))
  2276.    End If 
  2277.    Cline(MXCHAR)
  2278.    Put Key OBJ$
  2279.    Input "";OBJ$
  2280.    If Len(OBJ$)>MXCHAR
  2281.       OBJ$=Left$(OBJ$,Min(31,MXCHAR))
  2282.    End If 
  2283.    Curs Off 
  2284. End Proc[OBJ$]
  2285. Procedure CONTINUE
  2286.    Locate 0,23
  2287.    Pen 2 : Print "Press any key or mouse button to continue."; : Pen 1
  2288.    A$="" : M=0
  2289.    Clear Key 
  2290.    Do 
  2291.       Multi Wait 
  2292.       A$=Inkey$ : M=Mouse Click
  2293.       Exit If A$<>""
  2294.       Exit If M>0
  2295.    Loop 
  2296.    Cls 
  2297. End Proc
  2298. Procedure _GET_SYS_MOUSE
  2299.    '
  2300.    ' Version 1.0 ** Michael Sikorsky **  JAN/93 
  2301.    '   shortened and modified JUN/93 for The Home Accountant  
  2302.    '      by Vincent Platt
  2303.    '
  2304.    RET=True
  2305.    Hide 
  2306.    If Not Exist("devs:system-configuration")
  2307.       N0TICE["You have no devs:system-configuration file.  No change made.",0]
  2308.       RET=False : Goto _ENDING
  2309.    End If 
  2310.    Open In 1,"devs:system-configuration"
  2311.    Reserve As Work 5,120
  2312.    Sload 1 To Start(5),120
  2313.    Close 1
  2314.    '
  2315.    '  Select Which Sprite # you want the new mouse to be
  2316.    '
  2317.    MOUSE_IMAGE=1
  2318.    '
  2319.    ' get mouse colors 
  2320.    '
  2321.    C18=(Deek(Start(5)+$66))
  2322.    C17=(Deek(Start(5)+$68))
  2323.    C19=(Deek(Start(5)+$6A))
  2324.    C16=(Deek(Start(5)+$6E))
  2325.    '
  2326.    ' Using the mouse colors only  
  2327.    '
  2328.    Palette ,,,,,,,,,,,,,,,,C16,C17,C18,C19
  2329.    '
  2330.    ' Open Up a screen to work with
  2331.    '
  2332.    Screen Open 7,16,16,4,Hires
  2333.    Screen Hide 7
  2334.    '
  2335.    '  Draw image on screen
  2336.    '
  2337.    For Y=0 To 15
  2338.       '
  2339.       ' read in the bitplanes... 
  2340.       '   A$ =holds the bits for the first  bitplane   
  2341.       '   A1$=  "    "    "   "   "  second    " 
  2342.       '
  2343.       A$=Bin$(Deek(Start(5)+$20+4*Y),16)
  2344.       A1$=Bin$(Deek(Start(5)+$22+4*Y),16)
  2345.       '
  2346.       For X=2 To 17
  2347.          
  2348.          '
  2349.          ' t$ holds the a bit on the 1st bitplane and 
  2350.          ' the corresponding bit on the 2nd bitplane  
  2351.          '
  2352.          T$=Mid$(A$,X,1)+Mid$(A1$,X,1)
  2353.          
  2354.          If T$="00"
  2355.             C=0
  2356.          Else 
  2357.             If T$="01"
  2358.                C=1
  2359.             Else 
  2360.                If T$="10"
  2361.                   C=2
  2362.                Else 
  2363.                   If T$="11"
  2364.                      C=3
  2365.                   End If 
  2366.                End If 
  2367.             End If 
  2368.          End If 
  2369.          '  
  2370.          '
  2371.          Ink C : Plot X-2,Y
  2372.       Next 
  2373.       '
  2374.    Next 
  2375.    '
  2376.    ' Get the image for the new mouse    
  2377.    '
  2378.    Get Bob MOUSE_IMAGE,0,0 To 0+16,0+16
  2379.    '
  2380.    '
  2381.    ' figure out where the HotSpot is  
  2382.    '
  2383.    ' read in 2 bytes ( eg. FF & FE )
  2384.    HX$=Hex$(Peek(Start(5)+$64))
  2385.    HY$=Hex$(Peek(Start(5)+$65))
  2386.    '
  2387.    HX$=Mid$(HX$,Len(HX$),1)
  2388.    HY$=Mid$(HY$,Len(HY$),1)
  2389.    '
  2390.    HX=Instr("FEDCBA9876543210",HX$,0)-1
  2391.    HY=Instr("0FEDCBA987654321",HY$,0)-1
  2392.    '
  2393.    Hot Spot MOUSE_IMAGE,HX,HY
  2394.    Change Mouse 3+MOUSE_IMAGE
  2395.    
  2396.    '
  2397.    ' close the work screen
  2398.    Screen Close 7
  2399.    ' display the new mouse
  2400.    Show 
  2401.    '    
  2402.    Erase 5 : DUMMY=Free
  2403.    '
  2404.    _ENDING:
  2405. End Proc[RET]
  2406. '*************************  procs end  **********************************